

function addSensorbitCod(Blockly) {







    //TM1650 数码管初始化
  Blockly.Python.microbit_tm1650Init = function(block) {
    Blockly.Python.definitions_['import_microbit'] = 'from microbit import *';
    Blockly.Python.definitions_['import_TM1650'] = 'from monitor import tm1650';
    // var code = 'TouchPiano.read('+ dropdown_pianoCLK +','+ dropdown_pianoDIO +') == ' + dropdown_piano2;
    var dropdown_tm1650Intensity = this.getFieldValue('tm1650Intensity');
    return 'tm1650.on('+dropdown_tm1650Intensity+')\n';
  }
  
   //TM1650 数码管展示
   Blockly.Python.microbit_tm1650display = function(block) {
    var dropdown_TM1650Bit = this.getFieldValue('TM1650Bit');
    //  var value_serialprint16nums = Blockly.Python.valueToCode(this, 'serialprint16nums', Blockly.Python.ORDER_ATOMIC);
      var dropdown_tm1650Data = Blockly.Python.valueToCode(this, 'tm1650Data', Blockly.Python.ORDER_ATOMIC);
      // var code = 'TouchPiano.read('+ dropdown_pianoCLK +','+ dropdown_pianoDIO +') == ' + dropdown_piano2;
      return 'tm1650.show_digit('+dropdown_tm1650Data+', '+dropdown_TM1650Bit+')\n';
  }

  // tm1650数码管显示数字
  Blockly.Python.microbit_tm1650ShowNumber = function(block){
    var dropdown_tm1650Number = Blockly.Python.valueToCode(this, 'tm1650Number', Blockly.Python.ORDER_ATOMIC);
    return 'tm1650.show_number('+dropdown_tm1650Number +')\n';
  };

  // tm1650数码管显示小数点
  Blockly.Python.microbit_tm1650PointDisplay = function(block){
    var dropdown_tm1650Point = this.getFieldValue('tm1650Point');
    var dropdown_TM1650PointBit = this.getFieldValue('TM1650PointBit');
    return 'tm1650.show_dp('+dropdown_TM1650PointBit+', '+dropdown_tm1650Point+')\n';
  };


  //TM1650 数码管清屏
  Blockly.Python.microbit_tm1650Clear = function(block) {
    // var dropdown_TM1650Bit = this.getFieldValue('TM1650Bit1');
    
    return 'tm1650.clear()\n';
  }


    return Blockly;
}

module.exports = addSensorbitCod;

